﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace SchoolAuthentication
{
    public partial class AdminPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["delete"]!=null)
            {
                Membership.DeleteUser(Request.QueryString["delete"]);
            }
            MembershipUserCollection muc = Membership.GetAllUsers();
            foreach (MembershipUser mu in muc)
            { 
                if(mu!=null)
                    allUsers.InnerHtml +=Roles.GetRolesForUser(mu.UserName).FirstOrDefault() + ":" +  mu.UserName+" (<a href=\"AdminPage.aspx?delete="+mu.UserName+"\">delete</a>) <br/>";
            }
        }
    }
}